#pragma once
#include "Tile.h" 
#include "RectF.h"
#include "Sprite.h"

class Tilemap
{
private:
	Tile **tiles;
	const int width;
	const int height;

public:
	//Tilemap();
	Tilemap(const char *map, int mapWidth, int mapHeight, int tileWidth, int tileHeight);
	~Tilemap();
	void Draw(D3DGraphics &gfx) const;
	void GetCRectsList(CollisionRectF cRect, RectFList &list);
	bool GetCRectSingle(CollisionRectF &cRect, CollisionRectF &rectOut);
	void DoCollision(Sprite &s);
	void DoSupport(Sprite &s);

private:
	Tile *GetTile(int ix, int iy)const
	{
		return tiles[ix + width * iy];
	}
};

